﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.Practices.Unity;
using Shop.Infrastructure.Containers;

namespace Shop.Infrastructure.Web
{
    public class ShopApplication : System.Web.HttpApplication
    {
        public ShopApplication()
            : base()
        {
            //Container.Initialize();
        }

        protected virtual void Application_Start()
        {
            IControllerFactory controllerFactory = new ShopControllerFactory(Container.Current);
            ControllerBuilder.Current.SetControllerFactory(controllerFactory);
            System.Web.Mvc.ViewEngines.Engines.Clear();
            System.Web.Mvc.ViewEngines.Engines.Add(new ShopRazorViewEngine(Container.ShopConfig.CurrentViewTemplate));
        }
    }
}
